#include "lib.h"

#include "rlshare.h"
#include "euroguts.h"
#include "eurlbet.h"
#include "getrand.h"

EuropeanRouletteGuts::EuropeanRouletteGuts()
{
}

uint8 
EuropeanRouletteGuts::spin()
{
	static uint8 spots[37] = {14,2 ,20,29,31,0 ,10,28,17,24,36,19,
							  5 ,33,15,23,9 ,11,21,1 ,27,7 ,35,18,
							  26,6 ,13,32,8 ,30,12,4 ,16,34,3 ,22,
							  25};

	uint8 numRands = (uint8) (3*((getrand()/(DWORD)512) % 8)); 

	for(uint8 i = 0; i<numRands; i++)
	{
		getrand();
	}

	DWORD tempResult = getrand();
	bool8 found = false;
	while(!found)
	{
		if((tempResult)<(DWORD)429503141)
		{
			found = true;
		}
		else
		{
			tempResult = getrand();
		}
	}

	return (36-spots[(uint8)((getrand() % 148)/4)]);
}

bool8
EuropeanRouletteGuts::validateBet(uint8 wagerID)
{
	return EuropeanRouletteBet::isValidBet(wagerID);
}


RouletteBet *
EuropeanRouletteGuts::newBet(uint8 wagerID, int32 amount)
{
	return new EuropeanRouletteBet(wagerID, amount);
}
